#pragma once
#ifndef GAME_H
#define GAME_H
// Includes
#include <Core.h>
// Managers
#include <EntityManager.h>
#include <MessageHandler.h>
//#include <Animation.h>
#include <AnimationPlayer.h>
#include <ForceRegistry.h>
#include <StateMachine.h>
// Entites
#include "Player.h"
#include "Enemy.h"
#define ALLNODES 28
#define NEUTRALNODES ALLNODES-3
#include <Screen.h>
#include "Node.h"

class Game : public Core
{
private:
	double timeLeft;
	int target;
	D3DVIEWPORT9 viewport;
	ID3DXFont* font;

	// Textures for screens.
	IDirect3DTexture9* screenPauseTexture;
	IDirect3DTexture9* screenWinTexture;
	IDirect3DTexture9* screenLoseTexture;

	// textures for neutral nodes
	IDirect3DTexture9* nutralNodeAnim[NEUTRALNODES];
	IDirect3DTexture9* securedNodeAnim[NEUTRALNODES];
	IDirect3DTexture9* hackedNodeAnim[NEUTRALNODES];
	IDirect3DTexture9* hackingSecuredNodeAnim[NEUTRALNODES];
	IDirect3DTexture9* secureHackedNodeAnim[NEUTRALNODES];
	IDirect3DTexture9* hackingNeutralNodeAnim[NEUTRALNODES];
	IDirect3DTexture9* securingNeutralNodeAnim[NEUTRALNODES];

	//textures for cursor
	IDirect3DTexture9* playerIdleAnim;
	IDirect3DTexture9* playerCursorAnim;
	IDirect3DTexture9* playerTargetAnim;

	//player base anim
	IDirect3DTexture9* playerBaseIdleAnim;
	IDirect3DTexture9* playerBaseActiveAnim;

	//textures for enemy
	IDirect3DTexture9* enemyIdleAnim;
	IDirect3DTexture9* enemyCursorAnim;
	IDirect3DTexture9* enemyTargetAnim;

	//enemy base anim
	IDirect3DTexture9* enemyBaseIdleAnim;
	IDirect3DTexture9* enemyBaseActiveAnim;

	//finish base anim
	IDirect3DTexture9* finishBaseIdleAnim;
	IDirect3DTexture9* hackingFinishBaseAnim;
	IDirect3DTexture9* hackedFinishBaseAnim;
	IDirect3DTexture9* securingFinishBaseAnim;
	IDirect3DTexture9* securedFinishBaseAnim;

	// Declare entites
	Player* player;
	Enemy* enemy;
	Node* node[ALLNODES];
	D3DXVECTOR3 nodePositions[ALLNODES];
	AnimationPlayer* tmp[ALLNODES];
	//adding links between nodes
	std::list<Node*> links[ALLNODES];
	
public:
	// StateMachine used for switching game states.
	StateMachine<Game> stateMachine;
	
	// Screen objects.
	Screen* screenPause;
	Screen* screenWin;
	Screen* screenLose;


	// Methods
	Game(HINSTANCE hInstance, int nShowCmd);
	virtual ~Game();
	void initialise();
	void loadContent();
	void unloadContent();
	void update(float frameTime);
	void render();
	int getTarget() { return target; }
};

#endif // GAME_H